package homework.jdbc.dao;

import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Created by Administrator on 2017/9/13.
 */
public class JDBCutils {
             private  static  Connection conn=null;
    @Nullable
    public  static Connection Connecti(){
        try{
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3307/test","root","123456");
            return  conn;
        }catch (Exception e){
            e.printStackTrace();
        }
        return  null;
    }
    public  static  void  close(){
        try {
            conn.close();
        }catch (SQLException e){
            e.printStackTrace();
        }
    }
}
